Skip to content

Complete list patterns and stop offering flags before a dash - #41

Merged
mikelangmayr merged 2 commits into
mainfrom
mike/completion-polish
Sep 28, 2026
Merged

mikelangmayr merged 2 commits into
mainfrom
mike/completion-polish

Conversation

@mikelangmayr

Copy link
Copy Markdown
Collaborator
  • TAB no longer lists every --flag alongside addresses; options complete once you type -
  • libby list gets its own completer: a daemon can stand alone there, and each level offers its % form, so libby list <TAB> starts at %.% and hsfei.%, and hsfei.%.<TAB> offers the keywords across the group
  • Unit tests for the new candidates, including that no candidate is offered that fails to match the typed prefix
  • Verified by driving argcomplete's protocol against a live three-daemon fleet on a local broker

Comment thread libby/cli/completion.py
be ``%``, so each level offers its wildcard next to the concrete names.
"""
prefix = _peer_lowered(prefix)
if prefix.count(".") < 2:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cover this case? hsfei.% takes the daemon path and asks "which daemon starts with the text hsfei.%?" I think the current if condition is doing a startswith check so we aren't able to autocomplete when attempting to see the possible daemons associated with the group hsfei

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only the TAB completer, not the list command, which already handles hsfei.% on main.

Typing hsfei. and pressing TAB offers hsfei.% plus every daemon in the group, so the daemons are reachable one keystroke earlier. TAB after a typed % returns nothing on purpose: the shell replaces the whole word, so offering hsfei.adc there would delete the %.

Comment thread libby/cli/completion.py Outdated
)


def _peer_lowered(prefix: str) -> str:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In address_candidates you also do this check. Probably should have address_candidates also use this helper function

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, address_candidates now calls it and drops its own lower().

@mikelangmayr
mikelangmayr merged commit a4f6483 into main Sep 28, 2026
3 checks passed
@mikelangmayr
mikelangmayr deleted the mike/completion-polish branch September 28, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants